package com.example.mobile2021606140lhq0421;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

public class PartRVAdepter extends RecyclerView.Adapter<PartRVAdepter.ViewHolder> {
    @NonNull
    @Override



    public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext()).inflate(
                R.layout.item_rv_main_part,parent,false
        );
        return new ViewHolder(view);
    }

    @Override
    public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
        holder.ivPart.setText(partName[position]);
        holder.tvpart.setText(partNames[position]);

    }

    @Override
    public int getItemCount() {
        return partName.length;
    }


    String[] partName;
    String[] partNames;
    public PartRVAdepter(String[] partName,String[] partNames) {
        this.partName=partName;
        this.partNames=partNames;
    }


    static class ViewHolder extends RecyclerView.ViewHolder{
        TextView ivPart;
        TextView tvpart;
    public ViewHolder(View itemView) {
        super(itemView);
        this.ivPart=itemView.findViewById(R.id.iv_item_part);
        this.tvpart=itemView.findViewById(R.id.tv_item_part);
    }
    }
}
